﻿namespace GenricTypes;

public class FilteringStrategySelector
{
    private readonly Dictionary<string, Func<int, bool>> _filteringSelector = new Dictionary<string, Func<int, bool>>
    {
        ["Even"] = number => number % 2 == 0,
        ["Odd"] = number => number % 2 != 0,
        ["Positive"] = number => number > 0,
    };

    public Func<int, bool> Select(string filteringType)
    {
        if (!_filteringSelector.ContainsKey(filteringType))
        {
            throw new NotSupportedException(
                $"{filteringType} is not a valid filter.");
        }
        return _filteringSelector[filteringType];
    }
}